puts "Enter input file name: "
infile= gets().chomp

puts "Enter output file name: "
outfile=gets().chomp

begin
  input = File.new(infile, "r")
  output = File.new(outfile, "w")
  while line = input.gets
    output.puts "#{line.swapcase}"
  end
  input.close
  output.close

rescue Exception => e
  puts "Exception: #{e}"
end